Increasingly, Web Commerce applications and other distributed applications are run on application servers located at two or more data centers and are being served data from the two or more data centers. These data centers range from a few miles apart to a few thousand miles apart. The second (or nth) data center may serve as a virtual safe deposit box for realtime database backups, or on the opposite side of the spectrum, as a fully-functional data center, capable of handling all production traffic on its own.
The level to which the second (or nth) data center is used depends on the amount of acceptable downtime (Recovery Time Objective or RTO), the amount of acceptable data loss if a failure occurs (Recovery Point Objective or RPO), and finally the ability of an organization to execute (financial resources, competency, time, etc.).
Database replication programs are utilized to assure that databases at different data centers store the same copy of the application data. These programs monitor updates to a copy of the database made by an application server at one data center and transmit messages in an update stream to other data centers where the messages identify the changes made and cause the update of the database copies so that all databases maintain identical copies of the same data.
Efficient database access is important to many distributed applications. An application should be designed to require minimal access to the database and to ensure data integrity. An intelligent caching strategy is central to achieving these goals.
Distributed applications that require timely or related access to the latest data may use a distributed caching scheme where each application server of the distributed application maintains its own local cache.
The major issue to overcome in any distributed environment is updates being made to the same record at the same time from two or more distant databases. Due to latency, data replication between the databases must often be asynchronous. With asynchronous replication and no changes to configuration, the problem of data being overwritten or corrupted will always exist.
In the case of distributed caching, if one application server makes a change to a record in the database that is cached then all copies of that record that are cached by the other application servers will no longer be valid and processes relying on the invalid cached records will produce errors. The process of notifying other application servers in the same data center about changes to application data is known as distributed cache invalidation.